package staticDemo;
/*
    static : 静态的

    static 修饰的成员具备的特点:
        1. 被static修饰的成员被所有对象共享
        2. 被static修饰的成员能被类名直接调用
        3. 被static修饰的成员优先于对象加载的
        4. 被static修饰的成员随着类的加载而加载的
 */
public class Student {
    private String name;
    private int age;
    static String graduateFrom;

    public Student() {
    }

    public Student(String name, int age, String graduateFrom) {
        this.name = name;
        this.age = age;
        this.graduateFrom = graduateFrom;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGraduateFrom() {
        return graduateFrom;
    }

    public void setGraduateFrom(String graduateFrom) {
        this.graduateFrom = graduateFrom;
    }

    //在事物描述类中定义方法缺不让加static呢? 我就想让对象来调此方法
    public void show() {
        System.out.println("Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", graduateFrom='" + graduateFrom + '\'' +
                '}');
    }
}
